<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns the number of rows affected by an SQL statement</title>
 </head>
 <body class="docs"><div id="layout">
  <div id="layout-content"><div id="function.db2-num-rows" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">db2_num_rows</h1>
  <p class="verinfo">(PECL ibm_db2 &gt;= 1.0.0)</p><p class="refpurpose"><span class="refname">db2_num_rows</span> &mdash; <span class="dc-title">
   Returns the number of rows affected by an SQL statement
  </span></p>

 </div>
 <div class="refsect1 description" id="refsect1-function.db2-num-rows-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>db2_num_rows</strong></span>
    ( <span class="methodparam"><span class="type">resource</span> <code class="parameter">$stmt</code></span>
   ) : <span class="type">int</span></div>



  <p class="para rdfs-comment">
   Returns the number of rows deleted, inserted, or updated by an SQL
   statement.
  </p>
  <p class="para">
   To determine the number of rows that will be returned by a SELECT
   statement, issue SELECT COUNT(*) with the same predicates as your
   intended SELECT statement and retrieve the value.
  </p>
  <p class="para">
   If your application logic checks the number of rows returned by a SELECT
   statement and branches if the number of rows is 0, consider modifying your
   application to attempt to return the first row with one of
   <span class="function"><a href="db2_fetch_assoc.html" class="function">db2_fetch_assoc()</a></span>, <span class="function"><a href="db2_fetch_both.html" class="function">db2_fetch_both()</a></span>,
   <span class="function"><a href="db2_fetch_array.html" class="function">db2_fetch_array()</a></span>, or <span class="function"><a href="db2_fetch_row.html" class="function">db2_fetch_row()</a></span>,
   and branch if the fetch function returns <strong><code>FALSE</code></strong>.
  </p>

  <blockquote class="note"><p><strong class="note">Note</strong>: 
   <p class="para">
    If you issue a SELECT statement using a scrollable cursor,
    <span class="function"><strong>db2_num_rows()</strong></span> returns the number of rows returned by
    the SELECT statement. However, the overhead associated with scrollable
    cursors significantly degrades the performance of your application, so if
    this is the only reason you are considering using scrollable cursors,
    you should use a forward-only cursor and either call SELECT COUNT(*) or
    rely on the <span class="type"><a href="language.types.boolean.html" class="type boolean">boolean</a></span> return value of the fetch functions to
    achieve the equivalent functionality with much better performance.
   </p>
  </p></blockquote>

 </div>

 <div class="refsect1 parameters" id="refsect1-function.db2-num-rows-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<code class="parameter">stmt</code></dt>

     <dd>

      <p class="para">
       A valid <em>stmt</em> resource containing a result set.
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-function.db2-num-rows-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the number of rows affected by the last SQL statement issued by
   the specified statement handle.
  </p>
 </div>


 


 


</div></div></div></body></html>